package file;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;

public class Demo5 {
	public static void main(String[] args) {
		File file = new File("D:\\stu.txt");
		try {
			ObjectInputStream in = new ObjectInputStream(new FileInputStream(file));
			Student s = (Student) in.readObject();
			System.out.println(s.getName() + " " + s.getAge() + " " + s.getPhone());
			Student r = (Student) in.readObject();
			System.out.println(r.getName() + " " + r.getAge() + " " + r.getPhone());
			in.close();
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
